import request from '@/utils/request'
// 获取收藏列表的接口
export const collectList = data => request.get('/user/favorites')
// 获取房屋管理列表信息
export const rentList = data => request.get('/user/houses')
// 获取城市列表信息
export const cityList = data => request.get('/area/city', {
  params: {
    level: 1
  }
})
// 热门城市
export const hotList = () => request.get('/area/hot')
// 根据城市名称查询该城市信息 （当前城市）
export const getCityInfoByName = (name) => {
  return request.get('/area/info', {
    params: {
      name
    }
  })
}
// 发布房源接口
export const house = () => request.get('/houses/params')
// 发布房源上传
export const addHouse = data => request.post('/user/houses', data)
// 小区关键词查询接口
export const getCommunityByName = data => request.get('/area/community', {
  params: {
    name: data.name,
    id: data.id
  }
})
// 图片接口
export const getImage = file => {
  return request.post('/houses/image', file, {
    headers: { 'Content-Type': 'multipart/form-data' }
  })
}
// 根据区域id，查询该区域的房源数据
export const getAreaHouses = (id) => {
  return request.get('/area/map', {
    params: {
      id
    }
  })
}

// 根据条件查询房屋所需要的各种数据
export const getFilterHouses = (obj) => {
  console.log(obj)
  return request.get('/houses', {
    ...obj
  })
}
// 二级
export const getSecondArea = id => {
  return request.get('/area', {
    params: {
      id
    }
  })
}
// 删选条件的接口
export const getCondition = id => {
  return request.get('/houses/condition', {
    params: {
      id
    }
  })
}
